package tools.sql;

import java.sql.Connection;
import java.sql.DriverManager;

public class connect {
	
	/**
	 * @author thomas
	 * @param database
	 * @return
	 */
	public static Connection getConnection(String database){
		Connection conn = null;
		try {
			//System.out.print("Connecting to database...");
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			
			// String connectionstring = "jdbc:mysql://helgi10.medfarm.uu.se/bio";
			String connectionstring = "jdbc:mysql://localhost/"+database;	
			String username = "karln";
			String password = "robert";
			conn = DriverManager.getConnection(connectionstring,username,password);
			//System.out.println("Connected");
		}
		catch( Exception ex) {
			ex.printStackTrace();
		}
		return conn;
	}
}
